<template>
  <div>
    <button @click="goLink" style="padding:0 1em">绘制流程</button>

    <ul>
      <li>模型编号 模型名称 创建时间</li>
      <li v-for="item in list" :key="item.id">
        {{item.id}}
        {{item.name}}
        {{item.createTime}}
        &nbsp;
        <a
          @click="edit(item.id)"
        >编辑</a>
        &nbsp;
        <a @click="deleteItem(item.id)">删除</a>
        &nbsp;
        <a @click="deploy(item.id)">发布</a>
      </li>
    </ul>

    <form id="myForm" action="/models/newModel" method="post">
      Firstname:
      <input type="text" name="firstname" size="20">
      <br>Lastname:
      <input type="text" name="lastname" size="20">
      <br>
      <br>
      <input type="button" onclick="formSubmit()" value="Submit">
    </form>
  </div>
</template>

<script>
import { getMenu, getList, deleteItem, deployItem } from "@/api/sys/flow";
import { buildTableTree, treeShow } from "@/libs/tools";
import { mapState } from "vuex";
import config from "@/config/index.js";

export default {
  name: "imenu",
  data() {
    return {
      list: []
    };
  },
  computed: {},
  methods: {
    deleteItem(id) {
      deleteItem(id);
    },
    deploy(id) {
      deployItem(id);
    },
    goLink() {
      location.href = "http://192.168.43.169:8080/models/newModel=" + id;
    },
    edit(id) {
      location.href = "http://192.168.43.169:8080/editor?modelId=" + id;
    }
  },
  mounted() {
    let self = this;
    console.log(config, config.urlDomain);
    getList().then(({ data }) => {
      console.log(data);
      this.list = data;
    });
    // getMenu().then(({data})=>{
    //   console.log(data.modelId)
    //   window.open('/static/modeler?modelId='+data.modelId)
    // })
  }
};
</script>

<style scoped>
#myForm {
  display: none;
}
</style>
